import path from 'path'
import type { UserConfig } from 'vite'

const viteConfig: UserConfig = {
  // extensions: ['.js','.ts', '.vue', '.json', '.css'],
  // 导入别名
  alias: {
    '/@/': path.resolve(__dirname, './src/')
  },
  // 配置Dep优化行为
  optimizeDeps: {
    include: [
      'dayjs/plugin/isoWeek',
      'dayjs/plugin/customParseFormat',
      'dayjs/plugin/duration',
      'element-plus/lib/locale/lang/zh-cn'
    ]
  },
  sourcemap: 'inline',
  // 为开发服务器配置自定义代理规则。 http://113.31.105.128/front/doc.html
  proxy: {
    '/front': {
      target: 'http://edufront.lagou.com',
      changeOrigin: true,
      ws: true
    },
    '/boss': {
      target: 'http://eduboss.lagou.com',
      changeOrigin: true,
      ws: true
    }
  }
}

export default viteConfig
